package practice_1;
/*
	class Book{
		private String title;
		private double price;	
		public Book(String title ,double price) {
			this.price = price ;
			this.title = title ; 
			//price = price ;
			//title = title ; 
			//若无this ，因参数名和属性名相同，导致属性未被赋值成功，仍是原值
			System.out.println("1->"+title+"  "+price);
		}
		
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public double getPrice() {
			return price;
		}
		public void setPrice(double price) {
			this.price = price;
		}

		public String getInfo() {
			return "name = "+title+"  "+"price = "+price;
		}
		
	}

public class ricite_1 {

	public static void main(String[] args) {
	
	Book book = new Book("Java开发",79);
	System.out.println(book.getInfo());
	System.out.println("————————————————————————————");
	Book1 book12 = new Book1();
	System.out.println(book12.getInfo());
	Book1 book13 = new Book1("cyuyan");
	System.out.println(book13.getInfo());	
	Book1 book11 = new Book1("Pythoy", 57);
	System.out.println(book11.getInfo());
	}

}

class Book1{
	private String title;
	private double price;
	public Book1() {
		System.out.println("一个新Book1类产生");
	}
	public Book1(String title) {
		this();
		this.title = title;
	}
	public Book1(String title,double price) {
		this(title);
		this.price = price;
	}
	public String getInfo() {
		return "name = "+title+"  "+"price = "+price;
	} 
} **/

public class ricite_1{
	public static void main(String args[]) {
		new Cat();
		//new Cat("1");
		//new Animal(1);
		//new Animal();
	}
	
}
class Animal{
	public Animal() {
		super();
		System.out.println("1.Animal类的无参构造函数在执行~");
	}
	public Animal(int i) {
		super();
		System.out.println("2.Animal类的int 构造函数在执行~"+"i = "+i);
	}
}
class Cat extends Animal{
	public Cat() {
		//this("aaa");  //调用Cat类中str参数 的方法
		this(11,22);  //调用Cat类中的int，int参数的方法
		System.out.println("3.Cat 类的无参构造函数在执行~");
	}
	public Cat(String str) {
		super(5);
	
		System.out.println("--");
		System.out.println("4.Cat 类的str 有参构造函数在执行~");
	}
	public Cat(int i,int j) {
		System.out.println("i = "+i+"  "+"j = "+j);
	}
	
}











